1      REM --- CLAVIER INSTRUCTIONS BASIC ---------------
2      REM --- MORIN Claudius *** Sept 84 ---------------
98      REM --- Initialisation ---------------------------
99      REM 
100      CLEAR 5000
110      DIM A%(95),B$(95)
120      COLORT 9 11 9 13
497      REM 
498      REM --- Prise de donnees -------------------------
499      REM 
500      PRINT CHR$(12):CURSOR 0,12
510      PRINT "   Voulez-vous inscrire les instructions"
520      PRINT "               pour la premiere fois (O/N) ?";
530      GOSUB 2000
540      IF Y%=78 GOTO 1800
550      PRINT CHR$(12)
560      PRINT "Code ASCII   touche enfoncee   instruction correspondante"
570      FOR T%=1 TO 95
580      IF T%=33 OR T%=61 OR T%=64 OR T%=65 OR (T%>91 AND T%<95) THEN C$="":GOTO 630
590      S%=T%+31
600      IF S%<100.0 THEN PRINT " ";
610      PRINT S%;" = #";HEX$(S%);"    '";:POKE #76,#FF:PRINT CHR$(S%);"'";SPC(14);
620      INPUT C$:PRINT 
630      B$(T%)=C$+"0"
640      A%(T%)=A%(T%-1.0)+D%
650      D%=LEN(B$(T%))
660      NEXT
670      A%(0)=A%(T%-1)+D%
697      REM 
698      REM --- Verifications -------------------------------
699      REM 
700      PRINT CHR$(12);
710      PRINT "      Verifiez, notez les codes ASCII pour lesquels une":PRINT "modification est necessaire."
720      PRINT "Le 0 apres l'instuction est un separateur."
730      PRINT "Le nombre de caracteres cumules est au bout de la ligne."
740      IF A%(0)>511 THEN PRINT :PRINT :PRINT " Modification obligatoire, vous depassez les 512 octets.":PRINT :PRINT "         Pour la suite 'ESPACE'"
750      IF GETC=0 AND A%(0)>511 GOTO 750
760      FOR S%=0 TO 4
770      FOR T%=1 TO 19
780      R%=(19*S%)+T%
790      IF R%+31<100 THEN PRINT " ";
800      PRINT R%+31.0;" = #";HEX$(R%+31);"   touche '";:POKE #76,#FF:PRINT CHR$(R%+31);"'   ";B$(R%);
810      IF R%=95.0 THEN R%=-1
820      PRINT TAB(54);:IF A%(R%+1.0)<100.0 THEN PRINT " ";:IF A%(R%+1.0)<10.0 THEN PRINT " ";
830      PRINT A%(R%+1.0)
840      NEXT
850      PRINT "                Pour la suite ''ESPACE''";
860      IF GETC=0.0 GOTO 860
870      PRINT CHR$(12):PRINT :NEXT
897      REM 
898      REM --- Modifications ----------------------------
899      REM 
900      PRINT CHR$(12)
910      PRINT "est-il necessaire de modifier (O/N) ?"
920      GOSUB 2000
930      IF Y%=78 GOTO 1200
940      PRINT :PRINT "indiquez le numero du code ASCII ou 0 pour vous arreter."
950      INPUT C%:IF C%=0.0 GOTO 1040
955      INUT=0
960      IF C%<32.0 OR C%=64.0 OR C%=92.0 OR C%=95.0 OR C%=96.0 OR (C%>122.0 AND C%<126.0) OR C%>126.0 THEN INUT=1
965      IF INUT=1 THEN PRINT " CODE INUTILISABLE, PAS DE TOUCHE CORRESPONDANT":GOTO 940
970      PRINT :PRINT :PRINT "ASCII=#";HEX$(C%);",touche '";CHR$(C%);"'  instruction :";
980      C%=C%-31
990      PRINT LEFT$(B$(C%),LEN(B$(C%))-1.0)
1000      INPUT "indiquez la nouvelle instruction. ";C$:PRINT 
1020      B$(C%)=C$+"0"
1030      GOTO 940
1040      D%=0:A%(0.0)=0
1050      FOR T%=1 TO 95
1060      A%(T%)=A%(T%-1)+D%
1070      D%=LEN(B$(T%))
1080      NEXT
1090      A%(0)=A%(T%-1)+D%
1100      IF A%(0.0)>511.0 GOTO 700
1110      PRINT :PRINT "voulez-vous verifier a nouveau (O/N) ?"
1120      GOSUB 2000
1130      IF Y%=79.0 GOTO 700
1197      REM 
1198      REM --- Sauvegarde des donnees ------------------
1199      REM 
1200      PRINT CHR$(12)
1210      CURSOR 0,18
1220      PRINT "Choisissez un emplacement sur la bande magnetique"
1230      PRINT "pour sauvegarder les instructions."
1240      PRINT :PRINT "                  Pour la suite ''ESPACE''"
1250      POKE #40,#28:REM mise en marche du moteur
1260      IF GETC=0 GOTO 1260
1270      POKE #40,#30:REM arret du moteur
1280      PRINT :PRINT "Enclenchez la touche ''ENREGISTREMENT'' du magnetophone"
1290      PRINT :PRINT "                  Pour la suite ''ESPACE''"
1300      IF GETC=0 GOTO 1300
1310      SAVEA A% " CLAVIER BASIC"
1320      SAVEA B$ " CLAVIER BASIC"
1397      REM 
1398      REM --- Enregistrement des codes apres le PLM -------
1399      REM 
1400      C%=#365:REM adresse relative des instructions
1410      PRINT :PRINT "Patientez, j'enregistre les codes apres la routine en LM."
1420      E%=0:POKE #364,#FF
1430      FOR T%=1 TO 95
1440      S%=A%(T%)
1450      IF S%>255.0 AND E%=0.0 THEN E%=T%-1:POKE #364,E%
1460      IF S%>255 THEN S%=S%-256
1470      POKE C%+T%-1,S%
1480      NEXT
1490      C%=C%+T%-1
1500      S%=C% MOD 256:T%=INT(C%/256.0)
1510      POKE #350,S%:POKE #351,T%:REM adresse du debut des instructions
1520      FOR T%=1 TO 95
1530      IF LEN(B$(T%))=1.0 GOTO 1580
1540      FOR S%=1 TO LEN(B$(T%))-1.0
1550      E%=ASC(MID$(B$(T%),S%-1,1))
1560      POKE C%,E%:C%=C%+1
1570      NEXT
1580      POKE C%,0:C%=C%+1
1590      NEXT
1600      PRINT :PRINT "Pour sauvegarder le PLM"
1610      PRINT "ecrivez en UTILITAIRE: W2F0 ";HEX$(C%-1);" TITRE"
1620      PRINT :PRINT "Pour utiliser la routine,faire CALLM#2F0."
1630      PRINT "Pour supprimer la routine,faire CALLM#2F9."
1640      END
1797      REM 
1798      REM --- Lecture des donnees sur le magnetophone ----
1799      REM 
1800      PRINT CHR$(12)
1810      PRINT "Pour lire les anciennes instructions,"
1820      PRINT "enclenchez la touche ''LECTURE'' du magnetophone."
1830      LOADA A% 
1840      LOADA B$ 
1850      GOTO 700
1997      REM 
1998      REM --- O/N -------------------------------------
1999      REM 
2000      POKE #2C3,0
2100      Y%=GETC:IF Y%=0 GOTO 2100
2200      IF Y%<78 OR Y%>79 GOTO 2100
2300      RETURN
